package com.acando.feide.utils;

import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.Properties;

public class PropertyUtil {

    private static Properties propsInternal = null;

    /** 
     * Read and cache application configuration properties. Property file used is 'imp.properties'
     * 
     * @return Cached properties
     */
    public static Properties props() {
        if (propsInternal == null) {
            propsInternal = new Properties();
            FileInputStream is;
            try {
                is = new FileInputStream(new File("imp.properties"));
                propsInternal.load(is);

            } catch (FileNotFoundException e1) {
                e1.printStackTrace();
                System.exit(1);
            } catch (IOException e) {
                e.printStackTrace();
                System.exit(1);
            }
        }
        return propsInternal;
    }

}
